/**
 * Agreement 业务逻辑实现类
 * @author yanwl
 * @date 2014-09-11
 */
package com.chnbst.bstyun.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.chnbst.bstyun.core.base.BaseService;
import com.chnbst.bstyun.core.common.helper.DaoHelper;
import com.chnbst.bstyun.model.pojo.Agreement;
import com.chnbst.bstyun.service.AgreementService;

@Transactional
@Service
public class AgreementServiceImpl extends BaseService implements AgreementService {
	
	//声明日志对象 logback
	private final static Logger logger = LoggerFactory.getLogger(AgreementServiceImpl.class);
	private final static String nameSpace = "com.chnbst.bstyun.mapper.AgreementMapper";
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean deleteAgreement(Integer agreementId) {
		return DaoHelper.delete(nameSpace, "deleteAgreement", agreementId);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean insertAgreement(Agreement agreement) {
		return DaoHelper.insert(nameSpace, "insertAgreement", agreement);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean updateAgreement(Agreement agreement) {
		return DaoHelper.update(nameSpace, "updateAgreement", agreement);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public Agreement selectAgreementByAgreementId(Integer agreementId) {
		return (Agreement)DaoHelper.query(nameSpace, "selectAgreementByAgreementId", agreementId);
	}
	
	@SuppressWarnings("unchecked")
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public List<Agreement> selectAgreements() {
		return (List<Agreement>)DaoHelper.list(nameSpace, "selectAgreements", null);
	}
}
